<?php
use yii\helpers\Url;

$this->title = $isComplete ? '个人资料' : '完善个人资料';

// $gender = isset($userInfo['gender']) ? $userInfo['gender'] : '';
// $js = <<<JS
// var gender = "{$gender}";
// if (gender) {
//     if(gender === "女"){
//         $("#F").attr("selected", true)
//     }else{
//         $("#M").attr("selected", true)
//     }
// }
// JS;
// $this->registerJs($js, \yii\web\View::POS_END)
?>
<header class="header">
<a href="javascript:void(0);" onclick="javascript:history.go(-1);return false;">
    <i class="back-icon"></i>返回
</a>
</header>
<!-- <header class="header"><?= $isComplete ? '个人资料' : '完善个人资料' ?></header> -->
<?php if (!$isComplete) { ?>
    <div class="weui_cells_title waringColor">·请填写真实信息，获得会员赠礼！</div>
<?php } ?>
<form action="" method="post">
    <div class="weui_cells weui_cells_form titleColor">
        <div class="weui_cell">
            <div class="weui_cell_hd"><label class="weui_label">昵称</label></div>
            <div class="weui_cell_bd weui_cell_primary">
                <input class="weui_input" type="text" name="last_name" value="<?= isset($userInfo['last_name']) ? $userInfo['last_name'] : ''  ?>" placeholder="请输入昵称" required>
            </div>
        </div>
        <div class="weui_cell">
            <div class="weui_cell_hd"><label for="" class="weui_label">性别</label></div>
            <div class="weui_cell_bd weui_cell_primary">
                <select class="weui_input" type="text" id='msg_gender' name="gender" required>
                <option value="男" id="M" <?php if($userInfo['gender'] == '男'){echo 'selected';} ?>>男</option>
                <option value="女" id="F" <?php if($userInfo['gender'] == '女'){echo 'selected';} ?>>女</option>
                </select> 
            </div>
        </div>

        <div class="weui_cell">
            <div class="weui_cell_hd"><label class="weui_label">手机</label></div>
            <div class="weui_cell_bd weui_cell_primary">
                <input class="weui_input" type="text" name="phone" value="<?= isset($userInfo['mobile']) ? $userInfo['mobile'] : '' ?>" placeholder="请输手机号码" disabled style="border:none;">
            </div>
        </div>

        <div class="weui_cell">
            <div class="weui_cell_hd"><label class="weui_label">生日</label></div>
            <div class="weui_cell_bd weui_cell_primary">
                <input class="weui_input" type="date" name="birthday"  value="<?= isset($userInfo['birthday'])? $userInfo['birthday']: ''?>" placeholder="请选择您的生日" required>
            </div>
        </div>

        <div class="weui_cell">
            <div class="weui_cell_hd"><label class="weui_label">电子邮箱</label></div>
            <div class="weui_cell_bd weui_cell_primary">
                <input class="weui_input" type="email" value="<?= isset($userInfo['email'])?$userInfo['email']:""?>" name="email" placeholder="输入您常用的电子邮箱">
            </div>
        </div>

        <!-- <div class="weui_cell">
            <div class="weui_cell_hd"><label class="weui_label">职业</label></div>
            <div class="weui_cell_bd weui_cell_primary">
                <input class="weui_input" type="text" name="professional" placeholder="请输入您的职业">
            </div>
        </div> -->
    </div>
    <input name="_csrf" type="hidden" id="_csrf" value="<?= Yii::$app->request->csrfToken ?>">
    <input name="code" type="hidden" id="code" value="<?= isset($userInfo['code']) ? $userInfo['code'] : '' ?>">
    <div class="weui_btn_area" id="">
        <input type="submit" class="weui_btn weui_btn_primary">
    </div>
</form>